package com.rockbb.common.dao;

import java.io.Serializable;
import java.util.List;

public interface EntityMapper<T> 
{
	/**
	 * Insert instance to database
	 * 
	 * @param o
	 */
	void insert(T o);

	/**
	 * Delete instance by primary key
	 * 
	 * @param id
	 */
	void delete(T o);

	/**
	 * Update instance in database
	 * 
	 * @param o
	 */
	void update(T o);

	/**
	 * Get one single instance by primary key 
	 * 
	 * @param id
	 * @return object instance
	 */
	T select(Serializable id);

	/**
	 * Get one single instance by multiple keys
	 * 
	 * @param params
	 * @return
	 */
	T select(T o);

	/**
	 * Get all instances
	 * 
	 * @return a list of object instances
	 */
	List<T> selectAll();

	/**
	 * Get the total amount
	 * 
	 * @return amount
	 */
	long countAll();
}
